<%-- 
    Document   : followupListForTicket
    Created on : Mar 27, 2013, 3:19:23 PM
    Author     : mudassar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../common/script.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <%@include file="../common/title.jsp" %>
        <script type="text/javaScript">
            var rules=new Array();
            rules[0]='startDate|required|please enter startDate'; 
            rules[1]='stopDate|required|please enter stopDate'; 
        </script>
    </head>
    <body onLoad="yav.init('form1',rules,'inline');">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/menu.jsp" %>

        <script type="text/javascript">
            $(function() {
                $( "#startDate" ).datepicker({dateFormat: 'yy-mm-dd'});
                $( "#stopDate" ).datepicker({dateFormat: 'yy-mm-dd'});
            });
        </script>

        <div class="in_02">
            <%@include file="../common/message.jsp" %>
            <form id="form1" name="form1"  method="POST" cssClass="userInputForm" >
                <h1><spring:message code="title.followupList"/></h1>
                <fieldset>
                    <legend>Select Disposition -</legend>

                    <table class="formTable">
                        <tr>
                            <td style="padding:5px 30px 1px 5px;">Start date:<br/>
                                <input name="startDate" id="startDate" value="${startDate}" class="userInputLarge"/>
                                <span id="errorsDiv_startDate" ></span></td>
                            <td style="padding:5px 30px 1px 5px;">Stop date:<br/>
                                <input  name="stopDate"  id="stopDate" value="${stopDate}" class="userInputLarge" />
                                <br/><span id="errorsDiv_stopDate"></span></td>
                            <td>Disposition:<br/><select name="dispositionId" id="dispositionId" style="margin-bottom: 5px">
                                    <option value="0">All</option>
                                    <c:forEach items="${dispositionList}" var="dispositionItem">
                                        <option value="${dispositionItem.dispositionId}" <c:if test="${dispositionItem.dispositionId==dispositionId}">selected</c:if>>${dispositionItem.dispositionName}</option>
                                    </c:forEach>
                                </select>
                            </td>
                            <sec:authorize ifAllGranted="ROLE_BF_SHOW_ALL_FOLLOWUP_LIST">
                                <td><spring:message code="assignedTo"/>:<br/>
                                    <select  name="userId"  id="userId" class="userInputMedium">
                                        <option value="0">All</option>
                                        <c:forEach items="${userList}" var="userItem">
                                            <option <c:if test="${userId==userItem.userId}">selected</c:if> value="${userItem.userId}">${userItem.username}</option>
                                        </c:forEach>
                                    </select><br/>
                                </td>
                            </sec:authorize>
                            <td>Customer Type:<br/>
                                <select  name="paymentTypeId"  id="paymentTypeId" class="userInputMedium">
                                    <option value="0">All</option>
                                    <c:forEach items="${paymentTypeList}" var="paymentTypeListItem">
                                        <option <c:if test="${paymentTypeId==paymentTypeListItem.paymentTypeId}">selected</c:if> value="${paymentTypeListItem.paymentTypeId}">${paymentTypeListItem.paymentTypeName}</option>
                                    </c:forEach>
                                </select><br/>
                            </td>

                            <td><input  type="submit" value="Go" name="Go"  style="margin:13px 0 0 0;" onclick="return yav.performCheck('form1', rules, 'inline');"/></td> 
                        </tr>
                    </table>
                </fieldset>
                &nbsp;&nbsp;&nbsp;<p style="float: right;padding-right: 10px;"><c:out value="${fn:length(followupList)}"/> <spring:message code="rowsFound"/></p>
                <table class="data_table" border="1px">
                    <tr class="header">
                        <th  width="50px"><spring:message code="tbl.ticketId"/></th>
                        <th  width="50px"><spring:message code="tbl.status"/></th>
                        <th  width="170px"><spring:message code="tbl.customerName"/></th>
                        <th  width="80px"><spring:message code="tbl.empId"/></th>
                        <th  width="70px"><spring:message code="tbl.mrNo"/></th>
                        <th  width="80px"><spring:message code="tbl.phone1"/></th>
                        <th  width="120px"><spring:message code="tbl.callType"/></th>
                        <th  width="100px"><spring:message code="tbl.followupDate"/></th>
                        <th  width="100px"><spring:message code="tbl.lastModifiedDate"/></th>
                        <th  width="80px"><spring:message code="tbl.registrationStatus"/></th>
                        <th  width="130px"><spring:message code="tbl.dispositionName"/></th>
                        <th  width="80px"><spring:message code="tbl.createdBy"/></th>
                        <th  width="80px">AssignedTo</th>
                        <th  width="80px">Customer Type</th>
                        <th>&nbsp;</th>

                    </tr>
                    <c:set var="nowdate" scope="request" value="${curDate}"/>
                    <c:forEach items="${followupList}" var="item">
                        <c:choose>
                            <c:when test="${item.important==true}">
                                <tr style="background-color:#FDB543;">  
                                    <td align="center"><c:out value="${item.ticketId}"/></td>
                                    <td align="center"><c:out value="${item.status}"/></td>
                                    <td><c:out value="${item.customerName}"/></td>
                                    <td align="center"><c:out value="${item.empId}"/></td>
                                    <td align="center"><c:out value="${item.mrNo}"/></td>
                                    <td><c:out value="${item.phone1}"/></td>
                                    <td><c:out value="${item.callTypeName}"/></td>
                                    <c:choose>
                                        <c:when test="${item.followupDate < nowdate}">
                                            <td style="background-color:pink;" align="center"><fmt:formatDate value="${item.followupDate}" pattern="dd-MM-yy hh:mm a"/></td>
                                            </c:when>
                                            <c:otherwise>
                                            <td align="center"><fmt:formatDate value="${item.followupDate}" pattern="dd-MM-yy hh:mm a"/></td>
                                            </c:otherwise>
                                        </c:choose>
                                    <td align="center"><fmt:formatDate value="${item.lastModifiedDate}" pattern="dd-MM-yy hh:mm a"/></td>
                                    <td align="center"><c:out value="${item.registrationStatus}"/></td>
                                    <td><c:out value="${item.dispositionName}"/></td>
                                    <td align="center"><c:out value="${item.createdBy}"/></td>
                                    <td align="center"><c:out value="${item.assignedTo1}"/></td>
                                    <td align="center"><c:out value="${item.paymentTypeName}"/></td>
                                    <td><a href="editCustomer.htm?customerId=<c:out value="${item.customerId}"/>"><img src="../images/edit.png"  width="20" height="20" style="border: none" alt="Edit" title="Edit"/></a></td>
                                </tr>    

                            </c:when>
                            <c:otherwise>
                                <tr> 
                                    <td align="center"><c:out value="${item.ticketId}"/></td>
                                    <td align="center"><c:out value="${item.status}"/></td>
                                    <td><c:out value="${item.customerName}"/></td>
                                    <td align="center"><c:out value="${item.empId}"/></td>
                                    <td align="center"><c:out value="${item.mrNo}"/></td>
                                    <td><c:out value="${item.phone1}"/></td>
                                    <td><c:out value="${item.callTypeName}"/></td>
                                    <c:choose>
                                        <c:when test="${item.followupDate < nowdate}">
                                            <td style="background-color:pink;" align="center"><fmt:formatDate value="${item.followupDate}" pattern="dd-MM-yy hh:mm a"/></td>
                                            </c:when>
                                            <c:otherwise>
                                            <td align="center"><fmt:formatDate value="${item.followupDate}" pattern="dd-MM-yy hh:mm a"/></td>
                                            </c:otherwise>
                                        </c:choose>
                                    <td align="center"><fmt:formatDate value="${item.lastModifiedDate}" pattern="dd-MM-yy hh:mm a"/></td>
                                    <td align="center"><c:out value="${item.registrationStatus}"/></td>
                                    <td><c:out value="${item.dispositionName}"/></td>
                                    <td align="center"><c:out value="${item.createdBy}"/></td>
                                    <td align="center"><c:out value="${item.assignedTo1}"/></td>
                                    <td align="center"><c:out value="${item.paymentTypeName}"/></td>
                                    <td><a href="editCustomer.htm?customerId=<c:out value="${item.customerId}"/>"><img src="../images/edit.png"  width="20" height="20" style="border: none" alt="Edit" title="Edit"/></a></td> 
                                </tr>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>
                </table>
            </form>
            &nbsp;&nbsp;&nbsp;<p style="float: left;padding-left: 20px;"><c:out value="${fn:length(followupList)}"/> <spring:message code="rowsFound"/></p>
            <br/><br/><br/>
        </div>
    </body>
</html>
